package cn.iocoder.yudao.module.exam.dal.mysql.paperquestion;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.exam.dal.dataobject.paperquestion.PaperQuestionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.exam.controller.admin.paperquestion.vo.*;

/**
 * 试卷试题 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PaperQuestionMapper extends BaseMapperX<PaperQuestionDO> {

    default PageResult<PaperQuestionDO> selectPage(PaperQuestionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PaperQuestionDO>()
                .eqIfPresent(PaperQuestionDO::getPaperId, reqVO.getPaperId())
                .eqIfPresent(PaperQuestionDO::getQuestionId, reqVO.getQuestionId())
                .eqIfPresent(PaperQuestionDO::getSortNo, reqVO.getSortNo())
                .eqIfPresent(PaperQuestionDO::getQuestionText, reqVO.getQuestionText())
                .eqIfPresent(PaperQuestionDO::getQuestionType, reqVO.getQuestionType())
                .eqIfPresent(PaperQuestionDO::getDifficultyLevel, reqVO.getDifficultyLevel())
                .eqIfPresent(PaperQuestionDO::getQuestionUrl, reqVO.getQuestionUrl())
                .eqIfPresent(PaperQuestionDO::getQuestionScore, reqVO.getQuestionScore())
                .betweenIfPresent(PaperQuestionDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PaperQuestionDO::getVersion, reqVO.getVersion())
                .eqIfPresent(PaperQuestionDO::getBankId, reqVO.getBankId())
                .eqIfPresent(PaperQuestionDO::getCorrected, reqVO.getCorrected())
                .eqIfPresent(PaperQuestionDO::getAnswerKey, reqVO.getAnswerKey())
                .eqIfPresent(PaperQuestionDO::getAnswerUrl, reqVO.getAnswerUrl())
                .eqIfPresent(PaperQuestionDO::getAnalysis, reqVO.getAnalysis())
                .eqIfPresent(PaperQuestionDO::getAnalysisUrl, reqVO.getAnalysisUrl())
                .orderByDesc(PaperQuestionDO::getId));
    }

}